package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum OrdersRefundStatus {
	
	APPLY(0,"申请退款中"),
	SHOP_AGREE(1,"商家同意退款"),
	SHOP_REJECT(2,"商家拒绝退款"),
	PLATFORM_AGREE(3,"平台同意退款"),
	PLATFORM_REJECT(4,"平台拒绝退款"),
	COMPLETE(5,"退款完成");
	
	private Integer status;
	
	private String value;

	private OrdersRefundStatus(Integer status,String value){
		this.status = status;
		this.value = value;
	}

	public int toIntStatus() {
		return this.status;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static OrdersRefundStatus toFlag(int status) {
		if (APPLY.status == status) {
			return APPLY;
		} else if (SHOP_AGREE.status == status) {
			return SHOP_AGREE;
		} else if (SHOP_REJECT.status == status) {
			return SHOP_REJECT;
		} else if (PLATFORM_AGREE.status == status) {
			return PLATFORM_AGREE;
		} else if (PLATFORM_REJECT.status == status) {
			return PLATFORM_REJECT;
		}else if (COMPLETE.status == status) {
			return COMPLETE;
		} else {
			throw new InvalidArgumentException("Unknown status[" + status + "].");
		}
	}
}
